<form class="well form-inline margin-horisontal" action="" method="POST" name="select_ds" onsubmit="return false;">
    <fieldset>
        <legend>Шаг 2. Загрузка инсталляционного пакета</legend>

        <?php echo Arr::getValue($params, 'message', ''); ?>
        <?php echo Arr::getValue($params, 'error', ''); ?>


        <input type="hidden" name="action" value="action">


        <div class="control-group">
        <label class="control-label" for="tbl">Объект</label>
            <div class="controls">
                <select id="tbl" name="tbl" class="input-xlarge">

                    <?php
                    $sources = Arr::getValue($params, 'sources', array());
                    $preSelectedId = Arr::getValue($params, 'preSelectedId', 0);

                    foreach ($sources as $key=>$val) {
                        $sel = ($key == $preSelectedId)? 'selected="selected"' : '';
                        echo '<option value="'.$val['id'].'" '.$sel.'>'.$val['tbl'].'</option>';
                    }
                    ?>
                </select>
                <span class="help-inline"></span>
            </div>
        </div>


        <div class="form-actions">
            <!--
            <button class="btn" onclick="download('<?php echo DISTR::InstallerPath; ?>');return false;">Скачать установщик</button>
            <button type="" class="btn" onclick="download('<?php echo DISTR::UpdaterPath; ?>');return false;">Скачать Updater</button>
            <button type="" class="btn" onclick="download('<?php echo DISTR::JavaDistrPath; ?>');return false;">Скачать Java</button>
            -->

        <div class="btn-group">
            <a class="btn btn-primary dropdown-toggle" href="#" data-toggle="dropdown"  onclick="return false;">
                <i class="icon-download-alt icon-white"></i> Скачать <span class="caret"></span>
            </a>
            <ul class="dropdown-menu">
                <li><a href="#" onclick="download('<?php echo DISTR::InstallerPath; ?>');return false;"><i class="icon-file"></i> Установщик</a></li>
                <li><a href="#" onclick="download('<?php echo DISTR::UpdaterPath; ?>');return false;"><i class="icon-file"></i> Updater</a></li>
                <li><a href="#" onclick="download('<?php echo DISTR::JavaDistrPath; ?>');return false;"><i class="icon-file"></i> Java</a></li>

                <li class="divider"></li>

                <li><a href="#" onclick="download('<?php echo DISTR::InstallerPath; ?>', 'zip');return false;"><i class="icon-file"></i> Установщик (ZIP)</a></li>
                <li><a href="#" onclick="download('<?php echo DISTR::UpdaterPath; ?>', 'zip');return false;"><i class="icon-file"></i> Updater (ZIP)</a></li>
                <li><a href="#" onclick="download('<?php echo DISTR::JavaDistrPath; ?>', 'zip');return false;"><i class="icon-file"></i> Java (ZIP)</a></li>
            </ul>
        </div>

        </div>


<script>

function download(url, zip) {
    zip = zip || false;
    var ext = zip? 'zip' : 'docx';
    var w = window.open (url+'sample_distr.'+ext+'?'+$('#tbl').val(), "Download","location=no,status=no,scrollbars=no,menubar=no,resizeable=no");
    return false;
}

</script>


    </fieldset>
</form>
